

#rm -rf TEST
#make clean
#make server
#make client
#make server-admin
#make genuid
#mkdir TEST
choices=7
cd TEST4
N=1000
../genuid $N
gnome-terminal --command="bash -c '../server --choices=$choices; echo hit ENTER...; read'"
sleep 2
../server-admin --reg
sleep 1
for ((i = 0; i < $N; i++)); do echo $i; ../client --uid=$i --passwd=`cat $i` --keyfile=K$i --reg; done
sleep 1
../server-admin --tally-keys
sleep 1
for ((i = 0; i < $N; i++)); do echo $i; ../client --keyfile=K$i --tally-key; done
sleep 1
../server-admin --vote
sleep 1
for ((i = 0; i < $choices; i++)) do tally[$i]=0; done
for ((i = 0; i < $N; i++));
do 
	echo $i
	v=$((`cat /dev/urandom|od -N1 -An -i` % $choices))
	../client --keyfile=K$i --vote=$v
	tally[$v]=`expr ${tally[$v]} + 1`;
done
sleep 1
../server-admin --tally
sleep 1
for ((i = 0; i < $N; i++)); do echo $i; ../client --keyfile=K$i --tally; done
sleep 1
../server-admin --done
for ((i = 0; i < $choices; i++)) do echo $i == ${tally[$i]}; done

